package com.chenjun.web.controller.oa;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.chenjun.common.base.ResultDto;
import com.chenjun.common.bean.Pagination;
import com.chenjun.common.model.DataGridModel;
import com.chenjun.core.service.oa.OaBillAttnMonthReportService;

/**
 * @Description: 部门月度统计
 * @author dongyibin
 * @date 2017-8-20 下午1:47:55
 */
@Controller
@SuppressWarnings("serial")
@RequestMapping("monthReport")
public class MonthReportController {
	@Autowired
	private OaBillAttnMonthReportService monthReportService;
	
	/**
	 * @Description: 进入预报统计页面
	 * @return
	 * @author dongyibin
	 * @date 2017-9-4 下午8:52:03
	 */
	@RequestMapping("/list.html")
	public String index(){
		return "/attendanceSelect/monthReport";
	}
			
	/**
	 * @Description: 根据部门统计月报 
	 * @param request
	 * @author dongyibin
	 * @date 2017-9-4 下午8:52:26
	 */
	@RequestMapping("/search")
	@ResponseBody
	public ResultDto getMonthReport(DataGridModel model) {
		ResultDto rtDto = new ResultDto();
		Pagination pagination;
		try {
			pagination = monthReportService.getMonthReport(model);
			rtDto.setData(pagination);
		} catch (Exception e) {
			rtDto.setMessage(ResultDto.ERROR);
			e.printStackTrace();
		}
		return rtDto;
	}
}
